package com.kx.controller;

import com.kx.bean.Toll;
import com.kx.service.CarService;
import com.kx.service.TollService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class TollController {

    @Autowired
    private TollService tollService;

    @RequestMapping(value = "/findAllTolls", method = RequestMethod.GET)
    @ResponseBody
    public Object findUserData(@RequestParam("page") Integer page, @RequestParam("limit") Integer limit) {
        return tollService.findData(page, limit);
    }

    @RequestMapping("/getOrderById")
    @ResponseBody
    public List<Toll> getOrderById(@RequestParam("uid") Integer uid) {
        return tollService.findOrdersByUid(uid);
    }

    @RequestMapping("/deleteToll")
    @ResponseBody
    public Object deleteToll(@RequestParam("fid") Integer fid){
        return tollService.deleteById(fid);
    }
}